import Vue from 'vue'
import Vuex from 'vuex'
import { GET_DATA } from './const';
import { GET_HLISTORY } from './const';

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    data: {},
    history: {}
  },
  mutations: {
    [GET_DATA] (state, data) {
      state.data = data
    },
    [GET_HLISTORY] (state, data) {
      state.history = data
    }
  },
  actions: {
    getData ({ commit }, params) {
      commit(GET_DATA, params)
    },
    getHistory ({ commit }, params) {
      commit(GET_HLISTORY, params)
    }
  },
  modules: {
  }
})

export default store
